package com.dayuanit.dy15.ebook.bookshop.mapper;

import com.dayuanit.dy15.ebook.bookshop.domain.CardDomain;
import com.dayuanit.dy15.ebook.bookshop.entity.Card;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CardMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Card record);

    int insertSelective(Card record);

    Card selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Card record);

    int updateByPrimaryKey(Card record);

    Card getByUserAndCommoId(@Param("userId") Long userId,
                             @Param("commodityId") Long commodityId);

    int updateBuyNum(@Param("userId") Long userId,
                     @Param("commodityId") Long commodityId);

    List<CardDomain> listCardByUserId(Long userId);

    int updateBuyNum4Del(Long cardId);
}